home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 June: Reference Library / Dev.CD Jun 95 / Dev.CD Jun 95.toast / What's New? / New System Software Extensions / QuickDraw 3D ß / Programming / Interfaces / QD3DLight.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-04  |  8.4 KB  |  309 lines  |  [TEXT/MPS ]

  1. /******************************************************************************
  2.  **                                                                             **
  3.  **     Module:        QD3DLight.h                                                  **
  4.  **                                                                          **
  5.  **                                                                          **
  6.  **                                                                          **
  7.  **     Purpose:     Generic light routines                                      **
  8.  **                                                                          **
  9.  **                                                                          **
  10.  **     Copyright (C) 1991-1994 Apple Computer, Inc. All rights reserved.     **    
  11.  **                                                                          **
  12.  **                                                                             **
  13.  *****************************************************************************/
  14. #ifndef QD3DLight_h
  15. #define QD3DLight_h
  16.  
  17. #if PRAGMA_ONCE
  18.     #pragma once
  19. #endif
  20.  
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif    /* __cplusplus */
  24.  
  25.  
  26. /******************************************************************************
  27.  **                                                                             **
  28.  **                            Enum Definitions                                 **
  29.  **                                                                             **
  30.  *****************************************************************************/
  31.  
  32. typedef enum TQ3AttenuationType {
  33.     kQ3AttenuationTypeNone,
  34.     kQ3AttenuationTypeInverseDistance,
  35.     kQ3AttenuationTypeInverseDistanceSquared
  36. } TQ3AttenuationType;
  37.  
  38.  
  39. typedef enum TQ3FallOffType {
  40.     kQ3FallOffTypeNone,
  41.     kQ3FallOffTypeLinear,
  42.     kQ3FallOffTypeExponential,
  43.     kQ3FallOffTypeCosine
  44. } TQ3FallOffType;
  45.  
  46.  
  47. /******************************************************************************
  48.  **                                                                             **
  49.  **                            Data Structure Definitions                         **
  50.  **                                                                             **
  51.  *****************************************************************************/
  52.  
  53. typedef struct TQ3LightData {
  54.     TQ3Boolean                    isOn;
  55.     float                        brightness;
  56.     TQ3ColorRGB                    color;
  57. } TQ3LightData;
  58.  
  59. typedef struct TQ3DirectionalLightData {
  60.     TQ3LightData                    lightData;
  61.     TQ3Boolean                    castsShadows;
  62.     TQ3Vector3D                    direction;
  63. } TQ3DirectionalLightData;
  64.  
  65. typedef struct TQ3PointLightData {
  66.     TQ3LightData                    lightData;
  67.     TQ3Boolean                    castsShadows;
  68.     TQ3AttenuationType            attenuation;
  69.     TQ3Point3D                    location;
  70. } TQ3PointLightData;
  71.  
  72. typedef struct TQ3SpotLightData {
  73.     TQ3LightData                    lightData;
  74.     TQ3Boolean                    castsShadows;
  75.     TQ3AttenuationType            attenuation;
  76.     TQ3Point3D                    location;
  77.     TQ3Vector3D                    direction;
  78.     float                        hotAngle;
  79.     float                        outerAngle;
  80.     TQ3FallOffType                fallOff;
  81. } TQ3SpotLightData;
  82.  
  83. typedef struct TQ3IncidentLight {
  84.     TQ3Vector3D    direction;    /*  Direction from surf. location to light      */
  85.     TQ3ColorRGB    color;        /*  color returned from light-surf. interaction */
  86. } TQ3IncidentLight;
  87.  
  88.  
  89. /******************************************************************************
  90.  **                                                                             **
  91.  **                    Light routines (apply to all TQ3LightObjects)             **
  92.  **                                                                             **
  93.  *****************************************************************************/
  94.  
  95. EXPORT TQ3ObjectType Q3Light_GetType(
  96.     TQ3LightObject        light);
  97.  
  98. EXPORT TQ3Status Q3Light_GetState(
  99.     TQ3LightObject        light,
  100.     TQ3Boolean            *isOn);
  101.                 
  102. EXPORT TQ3Status Q3Light_GetBrightness(
  103.     TQ3LightObject        light,
  104.     float                *brightness);
  105.     
  106. EXPORT TQ3Status Q3Light_GetColor(
  107.     TQ3LightObject        light,
  108.     TQ3ColorRGB            *color);
  109.     
  110. EXPORT TQ3Status Q3Light_SetState(
  111.     TQ3LightObject        light,
  112.     TQ3Boolean            isOn);
  113.                 
  114. EXPORT TQ3Status Q3Light_SetBrightness(
  115.     TQ3LightObject        light,
  116.     float                brightness);
  117.     
  118. EXPORT TQ3Status Q3Light_SetColor(
  119.     TQ3LightObject        light,
  120.     const TQ3ColorRGB    *color);
  121.  
  122. EXPORT TQ3Status Q3Light_GetData(
  123.     TQ3LightObject        light,
  124.     TQ3LightData            *lightData);
  125.  
  126. EXPORT TQ3Status Q3Light_SetData(
  127.     TQ3LightObject        light,
  128.     const TQ3LightData    *lightData);
  129.     
  130.  
  131. /******************************************************************************
  132.  **                                                                             **
  133.  **                            Specific Light Routines                               **
  134.  **                                                                             **
  135.  *****************************************************************************/
  136.  
  137. /******************************************************************************
  138.  **                                                                             **
  139.  **                            Ambient Light                                       **
  140.  **                                                                             **
  141.  *****************************************************************************/
  142.  
  143. EXPORT TQ3LightObject Q3AmbientLight_New(
  144.     const TQ3LightData        *lightData);
  145.  
  146. EXPORT TQ3Status Q3AmbientLight_GetData(
  147.     TQ3LightObject            light,
  148.     TQ3LightData                *lightData);
  149.  
  150. EXPORT TQ3Status Q3AmbientLight_SetData(
  151.     TQ3LightObject            light,
  152.     const TQ3LightData        *lightData);
  153.  
  154.  
  155. /******************************************************************************
  156.  **                                                                             **
  157.  **                        Directional Light                                     **
  158.  **                                                                             **
  159.  *****************************************************************************/
  160.  
  161. EXPORT TQ3LightObject Q3DirectionalLight_New(
  162.     const TQ3DirectionalLightData    *directionalLightData);
  163.     
  164. EXPORT TQ3Status Q3DirectionalLight_GetCastShadowsState(
  165.     TQ3LightObject                    light,
  166.     TQ3Boolean                        *castsShadows);
  167.     
  168. EXPORT TQ3Status Q3DirectionalLight_GetDirection(
  169.     TQ3LightObject                    light,
  170.     TQ3Vector3D                        *direction);
  171.     
  172. EXPORT TQ3Status Q3DirectionalLight_SetCastShadowsState(
  173.     TQ3LightObject                    light,
  174.     TQ3Boolean                        castsShadows);
  175.     
  176. EXPORT TQ3Status Q3DirectionalLight_SetDirection(
  177.     TQ3LightObject                    light,
  178.     const TQ3Vector3D                *direction);
  179.  
  180. EXPORT TQ3Status Q3DirectionalLight_GetData(
  181.     TQ3LightObject                    light,
  182.     TQ3DirectionalLightData            *directionalLightData);
  183.  
  184. EXPORT TQ3Status Q3DirectionalLight_SetData(
  185.     TQ3LightObject                    light,
  186.     const TQ3DirectionalLightData    *directionalLightData);
  187.  
  188.  
  189. /******************************************************************************
  190.  **                                                                             **
  191.  **                        Point Light                                              **
  192.  **                                                                             **
  193.  *****************************************************************************/
  194.  
  195. EXPORT TQ3LightObject Q3PointLight_New(
  196.     const TQ3PointLightData            *pointLightData);
  197.  
  198. EXPORT TQ3Status Q3PointLight_GetCastShadowsState(
  199.     TQ3LightObject                    light,
  200.     TQ3Boolean                        *castsShadows);
  201.     
  202. EXPORT TQ3Status Q3PointLight_GetAttenuation(
  203.     TQ3LightObject                    light,
  204.     TQ3AttenuationType                *attenuation);
  205.     
  206. EXPORT TQ3Status Q3PointLight_GetLocation(
  207.     TQ3LightObject                    light,
  208.     TQ3Point3D                        *location);
  209.  
  210. EXPORT TQ3Status Q3PointLight_GetData(
  211.     TQ3LightObject                    light,
  212.     TQ3PointLightData                *pointLightData);
  213.     
  214. EXPORT TQ3Status Q3PointLight_SetCastShadowsState(
  215.     TQ3LightObject                    light,
  216.     TQ3Boolean                        castsShadows);
  217.     
  218. EXPORT TQ3Status Q3PointLight_SetAttenuation(
  219.     TQ3LightObject                    light,
  220.     TQ3AttenuationType                attenuation);
  221.     
  222. EXPORT TQ3Status Q3PointLight_SetLocation(
  223.     TQ3LightObject                    light,
  224.     const TQ3Point3D                    *location);
  225.  
  226. EXPORT TQ3Status Q3PointLight_SetData(
  227.     TQ3LightObject                    light,
  228.     const TQ3PointLightData            *pointLightData);
  229.     
  230.  
  231. /******************************************************************************
  232.  **                                                                             **
  233.  **                        Spot Light                                              **
  234.  **                                                                             **
  235.  *****************************************************************************/
  236.  
  237. EXPORT TQ3LightObject Q3SpotLight_New(
  238.     const TQ3SpotLightData            *spotLightData);
  239.  
  240. EXPORT TQ3Status Q3SpotLight_GetCastShadowsState(
  241.     TQ3LightObject                    light,
  242.     TQ3Boolean                        *castsShadows);
  243.     
  244. EXPORT TQ3Status Q3SpotLight_GetAttenuation(
  245.     TQ3LightObject                    light,
  246.     TQ3AttenuationType                *attenuation);
  247.     
  248. EXPORT TQ3Status Q3SpotLight_GetLocation(
  249.     TQ3LightObject                    light,
  250.     TQ3Point3D                        *location);
  251.         
  252. EXPORT TQ3Status Q3SpotLight_GetDirection(
  253.     TQ3LightObject                    light,
  254.     TQ3Vector3D                        *direction);
  255.         
  256. EXPORT TQ3Status Q3SpotLight_GetHotAngle(
  257.     TQ3LightObject                    light,
  258.     float                            *hotAngle);
  259.         
  260. EXPORT TQ3Status Q3SpotLight_GetOuterAngle(
  261.     TQ3LightObject                    light,
  262.     float                            *outerAngle);
  263.         
  264. EXPORT TQ3Status Q3SpotLight_GetFallOff(
  265.     TQ3LightObject                    light,
  266.     TQ3FallOffType                    *fallOff);
  267.  
  268. EXPORT TQ3Status Q3SpotLight_GetData(
  269.     TQ3LightObject                    light,
  270.     TQ3SpotLightData                    *spotLightData);
  271.  
  272. EXPORT TQ3Status Q3SpotLight_SetCastShadowsState(
  273.     TQ3LightObject                    light,
  274.     TQ3Boolean                        castsShadows);
  275.     
  276. EXPORT TQ3Status Q3SpotLight_SetAttenuation(
  277.     TQ3LightObject                    light,
  278.     TQ3AttenuationType                attenuation);
  279.     
  280. EXPORT TQ3Status Q3SpotLight_SetLocation(
  281.     TQ3LightObject                    light,
  282.     const TQ3Point3D                    *location);
  283.  
  284. EXPORT TQ3Status Q3SpotLight_SetDirection(
  285.     TQ3LightObject                    light,
  286.     const TQ3Vector3D                *direction);
  287.  
  288. EXPORT TQ3Status Q3SpotLight_SetHotAngle(
  289.     TQ3LightObject                    light,
  290.     float                            hotAngle);
  291.         
  292. EXPORT TQ3Status Q3SpotLight_SetOuterAngle(
  293.     TQ3LightObject                    light,
  294.     float                            outerAngle);
  295.         
  296. EXPORT TQ3Status Q3SpotLight_SetFallOff(
  297.     TQ3LightObject                    light,
  298.     TQ3FallOffType                    fallOff);
  299.  
  300. EXPORT TQ3Status Q3SpotLight_SetData(
  301.     TQ3LightObject                    light,
  302.     const TQ3SpotLightData            *spotLightData);
  303.  
  304. #ifdef __cplusplus
  305. }
  306. #endif    /* __cplusplus */
  307.  
  308. #endif  /*  QD3DLight_h  */
  309.